home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6257 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  840 b 

  1. Path: charm.il.ft.hse.nl!not-for-mail
  2. From: robert@il.ft.hse.nl (robert)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Type casting
  5. Date: 23 Feb 1996 15:56:01 +0100
  6. Organization: LSD...melts in your mind, not in your hand
  7. Message-ID: <4gkki1$a7c@charm.il.ft.hse.nl>
  8. References: <4gfnmi$gsc@calvin.risq.qc.ca> <4gim30INNo4b@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: charm.il.ft.hse.nl
  10.  
  11. c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku):
  12.  >In article <4gfnmi$gsc@calvin.risq.qc.ca>,
  13.  >Pierre Coulombe <pcoulomb@criq.qc.ca> wrote:
  14.  >>  char string[80];
  15.  >>  strcpy(string, "25.4");
  16.  >Try char *string = "25.4". This is a waste.
  17.  >>  sprintf(string, "%f", (float) atof(string) * MM_TO_UNITS);
  18.              ^^^^^^ 
  19. It's not a waste, you can't be certain the result will fit in the 4
  20. chars.
  21.  
  22.                                                                 robert 
  23.